﻿<%@ Page Language="C#" %>

<%@ Import Namespace="FreedomERP.Models" %>
<%@ Import Namespace="Ext.Net" %>
<%@ Import Namespace="FreedomERP.Controllers" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        ShowWelcomeMsg();
        CreateMenuTree();
    }

    public void ShowWelcomeMsg()
    {
        BdAccount account = (BdAccount)HttpContext.Current.Session["user"];
        if (account != null)
        {
            lbMessage.Text = "[" + account.FAccount + "] 欢迎您！";
        }
    }

    public void CreateMenuTree()
    {
        TreePanel menuTree = new TreePanel();
        MenuPanel.Items.Add(menuTree);

        menuTree.ID = "MenuTree";
        menuTree.Width = Unit.Pixel(500);
        menuTree.Height = Unit.Pixel(200);
        menuTree.Title = "";
        menuTree.AutoScroll = true;

        menuTree.Listeners.Click.Handler = "onTreeItemClick('ContentTab',node)";

        Ext.Net.TreeNode root = new Ext.Net.TreeNode();
        root.NodeID = "root";
        root.Text = "菜单导航";
        root.Expanded = true;
        menuTree.Root.Add(root);

        MenuController menuController = new MenuController();
        Ext.Net.TreeNodeCollection childNodes = menuController.LoadCurUserMenu();
        if (childNodes != null && childNodes.Count > 0)
        {
            foreach (Ext.Net.TreeNode child in childNodes)
            {
                root.Nodes.Add(child);
            }
        }
        //Wilkie 20131012弹窗说明主页更新了
        Ext.Net.Notification.Show(new Ext.Net.NotificationConfig
        {
            Title = "最新消息提示",
            Icon = Icon.Information,
            PinEvent = "mouseover",
            Html = "自由主页更新了。"
        });
    }
</script>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
    <title>自由企业管理系统</title>
    <script src="/Scripts/main.js" type="text/javascript"></script>
    <script src="/Scripts/ExtTimeOut.js" type="text/javascript"></script>
    <link href="../../Content/header/css/style.css" rel="stylesheet" type="text/css" />
    <script src="../../Content/header/js/jquery-1.4.2.min.js" type="text/javascript"></script>
    <!--IE6透明判断-->
    <!--[if IE 6]>
    <script src="../../Content/header/js/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>
    DD_belatedPNG.fix('.flash_bar,#tit_fc1,#tit_fc2,#tit_fc3,#tit_fc4,#flashLine');
    </script>
    <![endif]-->
    <script type="text/javascript">
        var currentindex = 1;
        $("#flashBg").css("background-color", $("#flash1").attr("name"));
        function changeflash(i) {
            currentindex = i;
            for (j = 1; j <= 3; j++) {
                if (j == i) {
                    $("#flash" + j).fadeIn("normal");
                    $("#flash" + j).css("display", "block");
                    $("#f" + j).removeClass();
                    $("#f" + j).addClass("dq");
                    $("#flashBg").css("background-color", $("#flash" + j).attr("name"));
                }
                else {
                    $("#flash" + j).css("display", "none");
                    $("#f" + j).removeClass();
                    $("#f" + j).addClass("no");
                }
            }
        }
        function startAm() {
            timerID = setInterval("timer_tick()", 5000);
        }
        function stopAm() {
            clearInterval(timerID);
        }
        function timer_tick() {
            currentindex = currentindex >= 3 ? 1 : currentindex + 1;
            changeflash(currentindex);
        }
        $(document).ready(function () {
            $(".flash_bar div").mouseover(function () { stopAm(); }).mouseout(function () { startAm(); });
            startAm();
        });
    </script>
</head>
<body>
    <form id="Form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
    <ext:Viewport ID="Viewport1" runat="server" Layout="BorderLayout">
        <Items>
            <ext:Panel ID="Panel1" runat="server" Title="" Region="North" Split="false" Height="150"
                Html="" Collapsible="false" Layout="ColumnLayout">
                <TopBar>
                    <ext:Toolbar ID="TopBar" runat="server" Height="25">
                        <Items>
                            <ext:ToolbarFill ID="ToolbarFill1" runat="server">
                            </ext:ToolbarFill>
                            <ext:Label ID="lbMessage" runat="server" Text="" />
                            <ext:Label ID="Label1" runat="server" Text="&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;" />
                            <ext:LinkButton ID="lbLogout" runat="server" Text="[退出]" Icon="UserCross">
                                <DirectEvents>
                                    <Click Url="/Account/LogOut/" Timeout="60000" CleanRequest="true">
                                    </Click>
                                </DirectEvents>
                            </ext:LinkButton>
                            <ext:Label ID="Label2" runat="server" Text="&nbsp;&nbsp;&nbsp;&nbsp;" />
                        </Items>
                    </ext:Toolbar>
                </TopBar>
                <Items>
                    <ext:Panel ID="Panel7" runat="server" ColumnWidth="1" Height="125" Title="" Border="false">
                        <Content>
                            <!--flash begin-->
                            <div id="flashBg" style="background-color: rgb(11, 11, 11);">
                                <div id="flashLine">
                                    <div id="flash">
                                        <a href="#" target="_blank" id="flash1" style="display: block;" name="#0b0b0b">
                                            <img src="../../Content/header/images/16sucai_01.jpg" alt="" width="980" height="150" /></a>
                                        <a href="#" target="_blank" id="flash2" name="#194982" style="display: none;">
                                            <img src="../../Content/header/images/16sucai_02.jpg" alt="" width="980" height="150" /></a>
                                        <a href="#" target="_blank" id="flash3" name="#04304b" style="display: none;">
                                            <img src="../../Content/header/images/16sucai_03.jpg" alt="" width="980" height="150" /></a>
                                        <div class="flash_bar">
                                            <div class="dq" id="f1" onclick="changeflash(1)">
                                            </div>
                                            <div class="no" id="f2" onclick="changeflash(2)">
                                            </div>
                                            <div class="no" id="f3" onclick="changeflash(3)">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </Content>
                    </ext:Panel>
                    <%--<ext:Panel ID="Panel8" runat="server" ColumnWidth="0.5" Height="125" Title="" Border="false"
                        Layout="AbsoluteLayout">
                        <Items>
                            <ext:Label ID="lbMessage" runat="server" Text="" X="500" Y="70" />
                        </Items>
                    </ext:Panel>--%>
                </Items>
            </ext:Panel>
            <ext:Panel ID="MenuPanel" runat="server" Title="菜单" Region="West" Layout="AccordionLayout"
                Width="225" MinWidth="225" MaxWidth="400" Split="true" Collapsible="true">
                <Items>
                </Items>
            </ext:Panel>
            <ext:TabPanel ID="ContentTab" runat="server" Region="Center">
                <Items>
                    <ext:Panel runat="server" Title="业务导航" Border="false" Html="" />
                </Items>
            </ext:TabPanel>
        </Items>
    </ext:Viewport>
    </form>
</body>
</html>
